/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.mobiubiq.directory.client.widget;

import javax.microedition.lcdui.Graphics;
import org.kalmeo.kuix.core.Kuix;
import org.kalmeo.kuix.widget.Widget;

/**
 *
 * @author Marnix Renne
 */
public class WaitWidget extends Widget {
    public static final String WAIT_WIDGET_TAG = "wait";
    private int x = 0;
    private int increment = 1;
    
    public WaitWidget() {
        super(WAIT_WIDGET_TAG);
    }

    public void paint(Graphics g) {
        try {
            int width = this.getWidth();
            int height = this.getHeight();
            int color = 0;
            for (int i = width + x; i >= 0; i--) {
                g.setColor(color, color, color);
                g.drawRect(i, 0, i + 1, height);
                color--;
            }
            Thread.currentThread().sleep(100);
            this.invalidateAppearance();
        } catch (InterruptedException ex) {
            Kuix.alert(ex.getMessage());
        }
    }   
}
